package com.haidechizi.i18n.code.generator.common.message.holder;



import com.haidechizi.i18n.code.generator.common.message.generator.CodeGenerator;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 *
 */
public class GeneratorHolder {


    /**
     * 持有所有生成代码的实现类
     */
    private static final Map<String, CodeGenerator> generatorHolder = new ConcurrentHashMap<>(32);


    /**
     * 添加generator
     *
     * @param type
     * @param codeGenerator
     */
    public static final void addGenerator(String type, CodeGenerator codeGenerator) {
        generatorHolder.put(type, codeGenerator);
    }

    public static final CodeGenerator getInstance(String type) {
        return generatorHolder.get(type);
    }


}
